package com.kaishengit.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.kaishengit.pojo.Linkman;
import com.kaishengit.pojo.Linkrecord;
import com.kaishengit.pojo.User;
import com.kaishengit.util.CreateTime;
import com.kaishengit.util.MyUUID;

@Service
@Transactional
public class LinkrecordService extends BaseService {
	public List<Linkrecord> finAll(){
		return getLinkrecordDao().findAll();
	}
	
	public Linkrecord findById(String id){
		return getLinkrecordDao().findById(id);
	}
	
	public List<Linkrecord> finAllRecord(Linkman linkman){
		return getLinkrecordDao().findByLinkMan(linkman);
		
	}

	public void save(Linkrecord linkrecord,User user, Linkman linkman) {
		Linkrecord lr=new Linkrecord();
		lr.setUser(user);
		lr.setLinkman(linkman);
		lr.setId(MyUUID.createUUID().toString());
		lr.setCreatetime(CreateTime.createTime());
		lr.setContent(linkrecord.getContent());
		getLinkrecordDao().save(lr);
		
	}

	
}
